<template>
	<view :style="{ height: statusBarHeight}" class="uni-status-bar">
		<slot />
	</view>
</template>

<script>
	export default {
		name: "status-bar",
		data() {
			return {
				statusBarHeight: 20,
			}
		},
		mounted() {
			try {
				let systemInfoSync = uni.getStorageSync('cu-systemInfoSync');
				if (systemInfoSync) {
					this.statusBarHeight = systemInfoSync.statusBarHeight + 'px'
				}
				else {
					systemInfoSync = uni.getSystemInfoSync();
					uni.setStorageSync('cu-systemInfoSync',systemInfoSync)
					this.statusBarHeight = systemInfoSync.statusBarHeight + 'px'
				}
			} catch (e) {
				console.error('StorageSync异常-key:cu-systemInfoSync')
			}
		}
	}
</script>

<style lang="scss">
	.uni-status-bar {
		// width: 750rpx;
		height: 20px;
		// height: var(--status-bar-height);
	}
</style>